//
//  ImageViewOfEvev.m
//  03-UIResponder-封装button
//
//  Created by 王道林 on 16/7/18.
//  Copyright © 2016年 王道林. All rights reserved.
//

#import "ImageViewOfEvev.h"

@implementation ImageViewOfEvev
- (instancetype)initWithFrame:(CGRect)frame imageName:(NSString *)name target:(id)target action:(SEL)action
{
    self = [super initWithFrame:frame];
    if (self) {
        [self createFunctionWithName:name target:target action:action];
    }
    return self;
}
- (void)createFunctionWithName:(NSString *)name target:(id)target action:(SEL)action
{
    self.userInteractionEnabled = YES;
    self.image = [UIImage imageNamed:name];
    UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:target action:action];
    [self addGestureRecognizer:tap];
}

@end
